<%@page import="java.sql.*"%>
<%@page import="com.mysql.*"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>

<%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Administration - View Rentals</title>
<link rel="stylsheet" href="css/style.css">
</head>
<body>
	<%
		try {
			Connection connection = DriverManager.getConnection(
					"jdbc:mysql://localhost:3306/moviedatabase", "dbuser",
					"dbpassword");
			Connection connection2 = DriverManager.getConnection(
					"jdbc:mysql://localhost:3306/moviedatabase", "dbuser",
					"dbpassword");

			Statement statement = connection.createStatement();
			Statement statement2 = connection2.createStatement();
			ResultSet rs = statement.executeQuery("select * from orders where returned = 0");
			ResultSet rs2 = statement2.executeQuery("Select * from orders where returned = 0");
	%>
	<h1>Movies currently rented</h1>
	<select>
		<%
			while (rs.next()) {
		%>

		<option>><%=rs.getString(1)%></option>


		<%
			}
		%>
	</select>	
	
	<table>
		<thead>
			<tr>
				<th>Order ID</th>
				<th>Inventory ID</th>
				<th>User ID</th>
			</tr>
		</thead>
		<tbody>
			<%
				while (rs2.next()) {
			%>
			<tr>
				<td><%=rs2.getString(1)%></td>
				<td><%=rs2.getString(2)%></td>
				<td><%=rs2.getString(3)%></td>
				<td><button>Return</button>
			</tr>
			<%
				}
			%>
		</tbody>
		

	</table>
	<%
		} catch (Exception e) {
			out.println("wrong entry" + e);
		}
	%>
	



</body>
</html>